<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 获取当前时间对象
        let date = new Date();
        let h = date.getHours().toString();
        let m = date.getMinutes().toString();
        let s = date.getSeconds().toString();

        let str = `${h.padStart(2,'0')}:${m.padStart(2,'0')}:${s.padStart(2,'0')}`;

        console.log(str);
        
    </script>
</body>
</html>